﻿/*********************弘石项目三组************************
*  功能描述：合同管理控制器
*  作者：郇博驿
*  时间：2021-12-8
*  修改人：郇博驿
*  修改时间：2021-12-8
*********************弘石项目三组************************/
using Hong.Business.Business_ContractManagement;
using Hong.Common.Encryption;
using Hong.IRepository;
using Hong.Model.SysDomain.Model_ContractManagement;
using Hong.Model.SysDomain.Model_ContractManagement.StaModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;

namespace WeHongshibApI.Controllers.Controllers_ContractManagement
{
    [ApiExplorerSettings(GroupName = "Contract")]
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ContracController : ControllerBase
    {
        #region 构造器注入
        private readonly ContractBusiness _contractRepository;
        public ContracController(ContractBusiness contractRepository)
        {
            _contractRepository = contractRepository;
        }
        #endregion

        

        #region 查询客户
        /// <summary>
        /// 查询客户
        /// </summary>
        /// <param name="name"></param>
        /// <param name="edCountryId2"></param>
        /// <param name="edCountryId3"></param>
        /// <param name="edTypeId"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetCustomers(string name, string edCountry2Nmae, string edCountry3Nmae, string edTypeName)
        {
            return Ok(_contractRepository.GetCustomers(name,edCountry2Nmae,edCountry3Nmae,edTypeName));
        }
        #endregion

        #region 添加合同
        /// <summary>
        /// 添加合同
        /// </summary>
        /// <param name="contractInfo"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddContract(ContractInfo contractInfo)
        {
            return Ok(_contractRepository.AddContract(contractInfo));
        }
        #endregion

        #region 结构形式下拉框
        /// <summary>
        /// 结构形式下拉框
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetStaStru()
        {
            return Ok(_contractRepository.GetStaStru());
        }
        #endregion

        #region 建筑分类下拉框
        /// <summary>
        /// 建筑分类下拉框
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetBuild()
        {
            return Ok(_contractRepository.GetBuild());
        }
        #endregion



        #region 合同列表

        #region 合同查询页
        /// <summary>
        /// 合同查询页
        /// </summary>
        /// <param name="pageindex">当前页</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="contractShowCondition">条件类</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> GetContractInfos(int pageindex, int pagesize, ContractShowCondition contractShowCondition)
        {
            return Ok(await _contractRepository.GetContractInfos(pageindex, pagesize, contractShowCondition));
        }
        #endregion


        #region 合同反填
        [HttpGet]
        public IActionResult GetContractInfosById(string id)
        {
            return Ok(_contractRepository.GetContractInfosById(id));
        }
        #endregion

        #region 合同修改
        /// <summary>
        /// 合同修改
        /// </summary>
        /// <param name="contractInfo"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult UpContractInfos(ContractInfo contractInfo)
        {
            return Ok(_contractRepository.UpContractInfos(contractInfo)) ;
        }

        #endregion
        #region 合同删除
        /// <summary>
        /// 合同删除
        /// </summary>
        /// <param name="contractInfo"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult DelContractInfos(string id)
        {
            return Ok(_contractRepository.DelContractInfos(id));
        }

        #endregion

        #region 合同收费列表
        /// <summary>
        /// 合同收费列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetContractLists(string id)
        {
            return Ok(_contractRepository.GetContractLists(id));
        }
        #endregion

        #region 合同收费
        /// <summary>
        /// 合同收费
        /// <param name="contractrateInfo"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddContractrateInfo(ContractrateInfo contractrateInfo)
        {
            return Ok(_contractRepository.AddContractrateInfo(contractrateInfo)) ;
        }

        #endregion

        #region 收费修改
        /// <summary>
        /// 收费修改
        /// </summary>
        /// <param name="contractrateInfo"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult UpContractrateInfo(ContractrateInfo contractrateInfo)
        {
            return Ok(_contractRepository.UpContractrateInfo(contractrateInfo)) ;
        }

        #endregion

        #region 收费删除
        /// <summary>
        /// 收费删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult DelContractrateInfo(string id)
        {
            return Ok(_contractRepository.DelContractrateInfo(id)) ;
        }
        #endregion

        #region 收费统计

        #region 总额

        #endregion
        #region 月份
        [HttpGet]
        public IActionResult Getmounth()
        {
            return Ok(_contractRepository.Getmounth());
        }
        #endregion
        #region 季度
        [HttpGet]
        public IActionResult Getquarter()
        {
            return Ok(_contractRepository.Getquarter());
        }
        #endregion
        #region 合同类型
        [HttpGet]
        public IActionResult GetcontractType()
        {
            return Ok(_contractRepository.GetcontractType());
        }
        #endregion

        #endregion

        #endregion
    }
}
